package com.cdks.wuxiu.api.service.mysql;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.cdks.wuxiu.api.mapper.AppVersionConfigMapper;
import com.cdks.wuxiu.entity.mysql.AppVersionConfig;

import org.springframework.stereotype.Service;


/**
 * APP版本信息表 服务实现类
 */
@Service
public class AppVersionConfigServiceImpl extends ServiceImpl<AppVersionConfigMapper, AppVersionConfig> implements AppVersionConfigService {
    @Override
    public AppVersionConfig getVersionByBranch(int branch) {
        QueryWrapper<AppVersionConfig> wrapper = new QueryWrapper<>();

        wrapper.lambda().eq(AppVersionConfig::getBranch, branch)
                        .orderByDesc(AppVersionConfig::getId);

        return baseMapper.selectOne(wrapper.last("LIMIT 1"));
    }
}
